package com.adcc.loadSheetForwarder.task;

import com.adcc.loadSheetForwarder.service.UmeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
@Slf4j
public class CheckTask {

    @Autowired
    private UmeService service;

    /**
     * 每五分钟测试航旅接口是否连通
     */
    @Scheduled(cron = "${umetrip.check-ume-status-cron}")
    public void checkUmeStatus() {
        log.info("checkUmeStatus start");
        try {
            service.checkUmeStatus();
        } catch (Exception e) {
            log.error("checkUmeStatus error()", e);
        }
        log.info("checkUmeStatus end");
    }
}
